package com.luntan.controller;


import com.luntan.bean.Article;
import com.luntan.mapper.ArticleMapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jw课程设计
 * @since 2022-07-12
 */
@RestController
@CrossOrigin
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    ArticleMapper articleMapper;

    @ApiOperation("获取所有文章")
    @GetMapping("getAllArticle")
    public List<Article> getAllArticle(){
        List<Article> a1 = new ArrayList<>();
        a1 = articleMapper.selectList(null);
        return  a1;
    }


//    @ApiOperation("按标题查询文章")
//    @PostMapping("getArticleByTitle")


//    @ApiOperation("按标签查询文章")
//    @PostMapping("getArticleByTag")



//    @ApiOperation("修改文章")
//    @PostMapping("updateArticle")


//    @ApiOperation("添加文章")
//    @PostMapping("addArticle")


    //@ApiOperation("删除文章")
//    @PostMapping("deleteArticle")

}

